package tools;

import book.Book;

import java.util.Comparator;

/**
 * Created with IntelliJ IDEA
 * Description:按书名排序的Comparator重写
 * User:22954
 * Date:2024-01-13
 * Time:19:25
 */
public class NameComparator implements Comparator<Book> {

    @Override
    public int compare(Book o1, Book o2) {
        return o1.getName().compareTo(o2.getName());
    }

    public int compare(String o1, String o2) {
        return o1.compareTo(o2);
    }
}
